const db = require('../config/db.js')

db.connect(function(err){
    if(err){
        throw err;
    }
    console.log('success...');
})

function query(sql){
    return new Promise((resolve,rejects)=>{
        db.query(sql,(err,reslut)=>{
            if(err){
                rejects(err)
            }else {
                resolve(reslut)
            }
        })
    })
}

module.exports = query